var __extends =
    (this && this.__extends) ||
    (function () {
      var t = function (e, n) {
        return (t =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (t, e) {
              t.__proto__ = e;
            }) ||
          function (t, e) {
            for (var n in e)
              Object.prototype.hasOwnProperty.call(e, n) && (t[n] = e[n]);
          })(e, n);
      };
      return function (e, n) {
        function o() {
          this.constructor = e;
        }
        if ("function" != typeof n && null !== n)
          throw new TypeError(
            "Class extends value " + String(n) + " is not a constructor or null"
          );
        t(e, n),
          (e.prototype =
            null === n
              ? Object.create(n)
              : ((o.prototype = n.prototype), new o()));
      };
    })(),
  KnifeMeetStartDialog = (function (t) {
    function e() {
      var e = t.call(this) || this;
      return (
        WebSocketService.addListener({
          caller: e,
          code: 5290,
          method: e.onLoadChuangjianZhenrongData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 5296,
          method: e.onLoadZhenRongTitleData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 5298,
          method: e.onLoadZhenRongData,
        }),
        WebSocketService.addListener({
          caller: e,
          code: 5295,
          method: e.onLoadEnterCoinData,
        }),
        e.btn_ddfh_start.on(Laya.Event.CLICK, e, e.onDDFHStartAction),
        e.btn_xiaozhangfayan.on(Laya.Event.CLICK, e, e.onXZFYSendAction),
        e.btn_zhanlipin.on(Laya.Event.CLICK, e, e.onSetZhanLiPinAction),
        e.btn_group1.on(Laya.Event.CLICK, e, e.onDidClickGroupAction),
        e.btn_group2.on(Laya.Event.CLICK, e, e.onDidClickGroupAction),
        e.btn_group3.on(Laya.Event.CLICK, e, e.onDidClickGroupAction),
        e
      );
    }
    return (
      __extends(e, t),
      (e.showStartDanDaoFuHuiDialog = function (t) {
        return (
          null == this.knifeMeetV &&
            ((this.knifeMeetV = new e()), (this.knifeMeetV.zOrder = 1e3)),
          this.knifeMeetV.popup(),
          (this.knifeMeetV.objDict = t),
          this.knifeMeetV.initData(),
          this.knifeMeetV
        );
      }),
      (e.prototype.initData = function () {
        (this.label_zhanlipin_item.text = ""),
          (this.selGroupId = "0"),
          (this.btn_xiaozhangfayan.visible = !1),
          this.lastButton &&
            ((this.lastButton.skin = "comp/commonpic/btn_fayoubao.png"),
            (this.lastButton.label = "选择")),
          (this.zhanlipinData = null),
          (this.text_xuanyan.text = "");
      }),
      (e.prototype.onLoadChuangjianZhenrongData = function (t) {}),
      (e.prototype.onLoadZhenRongData = function (t) {
        0 == t.code &&
          (this.close(),
          WebSocketService.send({ c: 5289, d: { roleId: Global.roleId } }),
          WebSocketService.send({ c: 5299, d: { roleId: Global.roleId } })),
          ToastView.toastView(t.msg);
      }),
      (e.prototype.onXZFYSendAction = function () {
        var t = this.text_xuanyan.text;
        WebSocketService.send({ c: 5296, d: { groupId: 0, notice: t } });
      }),
      (e.prototype.onSetZhanLiPinAction = function () {
        var t = this;
        ZhanLiPinView.openItemView("战利品", function (e) {
          t &&
            t.label_zhanlipin_item &&
            ((t.label_zhanlipin_item.text = e.title),
            (t.zhanlipinData = e.data));
        });
      }),
      (e.prototype.onDDFHStartAction = function () {
        return this.label_zhanlipin_item.text.length <= 0
          ? ToastView.toastView("请先设置战利品")
          : "0" == this.selGroupId
          ? ToastView.toastView("请先选择阵容")
          : ((this.zhanlipinData.groupId = this.selGroupId),
            void WebSocketService.send({ c: 5295, d: this.zhanlipinData }));
      }),
      (e.prototype.onLoadEnterCoinData = function (t) {
        var e = "等待您的挑战";
        this.text_xuanyan.text.length > 0 && (e = this.text_xuanyan.text),
          WebSocketService.send({
            c: 5296,
            d: { groupId: this.selGroupId, notice: e },
          });
      }),
      (e.prototype.onLoadZhenRongTitleData = function (t) {
        ToastView.toastView(t.msg),
          WebSocketService.send({
            c: 5298,
            d: { groupId: this.selGroupId, state: 1 },
          });
      }),
      (e.prototype.onDidClickGroupAction = function (t) {
        var e = t.target;
        this.lastButton &&
          ((this.lastButton.skin = "comp/commonpic/btn_fayoubao.png"),
          (this.lastButton.label = "选择")),
          "item1" == t.target.name
            ? (this.selGroupId = "1")
            : "item2" == t.target.name
            ? (this.selGroupId = "2")
            : "item3" == t.target.name && (this.selGroupId = "3"),
          (e.skin = "comp/commonpic/btn_dialog_silver.png"),
          (e.label = "已选"),
          (this.lastButton = e);
      }),
      e
    );
  })(ui.battlefield.KnifeMeetStartDialogUI);
